package demo1;

import java.util.Random;
public class ThreadDemo {
    private static class MyThread extends Thread {
        //新建类继承Thread，使这个类变成线程类
        @Override
        public void run() {
            System.out.println("这里是线程运行的代码");
        }
    }

    public static void main(String[] args) {
        //用线程类实例化对象
        MyThread thr1 = new MyThread();
        //启动线程
        thr1.start();
    }
}
